package com.nj.framework.util;

import java.nio.charset.Charset;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;

/**   
*    
* 项目名称：publicservice   
* 类名称：SpringMVCResult   
* @version
* 类描述：SpringMvc返回结果封装类
* @version   
* 创建人：王哲民   
* @version
* 创建时间：2012-6-11 下午03:36:25 
* @version  
* 修改人：王哲民    修改时间：2012-6-11 下午03:36:25   
* @version
* 修改备注：   
*
*/
public class SpringMVCResult {

	/**
	 * 字符串类型
	 * 
	 * @param result
	 * @return
	 */
	public static ResponseEntity<String> returnResponseEntity(String result){
		return returnResponseEntity(result, "text", "html");
	}
	
	/**
	 * 字符串类型
	 * 
	 * @param result 返回内容
	 * @param type 如：text
	 * @param subtype 如：html
	 * @return
	 */
	public static ResponseEntity<String> returnResponseEntity(String result,String type, String subtype){
		HttpHeaders headers = new HttpHeaders();
		MediaType mt = new MediaType(type, subtype, Charset.forName("UTF-8"));
		headers.setContentType(mt);
		return new ResponseEntity<String>(result, headers, HttpStatus.OK);
	}
}
